import { axios } from '@/utils/request'

export const getResourcePage = (params) => {
  return axios({
    url: 'resource',
    method: 'get',
    params
  })
}

export const getMenuTree = () => {
  return axios({
    url: 'resource/menu/tree',
    method: 'get'
  })
}

export const getResourceById = (id) => {
  return axios({
    url: 'resource/' + id,
    method: 'get'
  })
}

export const saveResource = (data) => {
  return axios({
    url: 'resource',
    method: 'post',
    data
  })
}

export const updateResourceById = (id, data) => {
  return axios({
    url: 'resource/' + id,
    method: 'put',
    data
  })
}

export const removeResourceById = (id) => {
  return axios({
    url: 'resource/' + id,
    method: 'delete'
  })
}
